//
//  YTHomeDLoadingView.m
//  yitaicaijing
//
//  Created by DIANGHONG on 2018/9/6.
//  Copyright © 2018年 DIANGHONG. All rights reserved.
//

#import "YTHomeDLoadingView.h"


#define kHomeDLoadImageCount 40
@interface YTHomeDLoadingView()

@property(nonatomic ,strong)UIImageView *loadImageView;

@end
@implementation YTHomeDLoadingView



// lazy loadImageView
- (UIImageView *)loadImageView
{
    if (!_loadImageView) {
        
        NSMutableArray *arrayM = [NSMutableArray arrayWithCapacity:5];
        
        for (int i = 0; i < kHomeDLoadImageCount; i++)
        {
            UIImage *img = [UIImage imageNamed:[NSString stringWithFormat:@"a%d",i + 1]];
            [arrayM addObject:img];
        }
        _loadImageView = [[UIImageView alloc] init];
        _loadImageView.animationImages = arrayM.copy;
        _loadImageView.animationRepeatCount = MAXFLOAT;
      
    }
    return _loadImageView;
}

- (instancetype)init
{
    self = [super init];
    if (self) {

    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    [self layoutIfNeeded];
    [self addSubview:self.loadImageView];
    self.loadImageView.center = self.center;
    self.backgroundColor = UIColor.whiteColor;
    [self.loadImageView sizeToFit];
    [self.loadImageView startAnimating];
}

@end
